import { interceptor } from './interceptor'
// import { parseQuery } from '../parseQuery'

// types

import { createKAxios, type CreateAxiosOptions, type KAxiosInstance } from '@kukefe/kkutils'

// 解析加密数据
// const { appId } = parseQuery(payOrderId)

const env = import.meta.env

const baseURL = env.NODE_ENV === 'production' ? env.VITE_PROXY_DOMAIN_REAL : env.VITE_PROXY_DOMAIN

console.log(baseURL, 'baseURL')

// 相关配置请参考：www.axios-js.com/zh-cn/docs/#axios-request-config-1
const defaultConfig: CreateAxiosOptions = {
  baseURL,
  interceptor,
  timeout: 20000,
  appId: 'kkc14071841',
  appKey: 'kkc6ureum8bn'
}

const http: KAxiosInstance = createKAxios(defaultConfig)

export default http
